package com.lc.pda.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lc.pda.dao.WmsTaskMapper;
import com.lc.pda.entity.WmsTask;
import com.lc.pda.service.WmsTaskService;
import com.lc.pda.util.Enums;
import com.lc.pda.util.RestResult;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zww
 * @since 2023-07-06
 */
@Service
public class WmsTaskServiceImpl extends ServiceImpl<WmsTaskMapper, WmsTask> implements WmsTaskService {

    @Override
    public RestResult getTask(String taskType, String trayCode) {
        return RestResult.success(list(Wrappers.<WmsTask>lambdaQuery()
                .eq(StringUtils.isNotEmpty(taskType), WmsTask::getTaskType, taskType)
                .eq(StringUtils.isNotEmpty(taskType), WmsTask::getTrayCode, trayCode)
                .lt(WmsTask::getTaskStatus, Enums.TaskStatusEnum.finish.getStatus()))
        );
    }
}
